<template>
  <!-- 雷达图  图表必须给高和宽度-->
  <div ref="myDiv" class="radar-echart" />
</template>

<script>
import * as echarts from 'echarts'
import radar from './radar.js'
export default {
  name: 'Radar',
  data() {
    return {
      echarts: null
    }
  },

  mounted() {
    this.echarts = echarts.init(this.$refs.myDiv) // 得到图表实例
    this.echarts.setOption(radar)
  },
  beforeDestroy() {
    this.echarts = null
  },
  created() {
    this.loadData()
  },
  methods: {
    loadData() {
      setTimeout(() => {
        const value1 = [60, 30, 90, 55, 90, 39]
        const value2 = [45, 76, 23, 54, 23, 43]
        radar.series[0].data[0].value = value1
        radar.series[0].data[1].value = value2
        this.echarts.setOption(radar)
      }, 3000)
    }
  }
}
</script>

<style lang="scss" scoped>
.radar-echart {
    width: 600px;
    height: 400px;
}
</style>
